package com.cw.controller;


import com.cw.annotation.AutoYard;
import com.cw.common.api.*;
import com.cw.dto.*;
import com.cw.entity.ThisIiInmaininfo;
import com.cw.request.BedUggieRequest;
import com.cw.request.PrintHospitalCertificateRequest;
import com.cw.request.VYqBrdjxxConditionRequest;
import com.cw.service.*;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @author smq
 * @since 2021-05-05
 */
@Api(tags = {"II_住院主表"})
@RestController
@RequestMapping("/this-ii-inmaininfo")
public class ThisIiInmaininfoController {
    
    private IThisIiInmaininfoService targetService;

    @Autowired
    private void setterAutowiredMethod(IThisIiInmaininfoService targetService) {
        this.targetService = targetService;
    }

    @AutoYard
    @PostMapping("/getThisIiInmaininfoPagination")
    @ApiOperation("住院登记记录-已登记")
    public ResultObject getThisIiInmaininfoPagination(@RequestBody InpatientRegistrationCondition condition) {
        return ResultObject.successReturn(targetService.getThisIiInmaininfoPagination(condition));
    }

    @PostMapping("/getPrintHospitalCertificate")
    @ApiOperation("住院证打印")
    public ResultObject getPrintHospitalCertificate(@RequestBody PrintHospitalCertificateRequest condition) {
        return ResultObject.successReturn(targetService.getPrintHospitalCertificate(condition));
    }

    /**
     * @author xnd
     * @since 2021-10-28
     * 床位异动验证，是不是转病区的患者
     */
    @PostMapping("/getBedUggIeCW")
    @ApiOperation("床位异动")
    public ResultObject getBedUggIeCW(@RequestBody BedUggieRequest request) {
        return ResultObject.successReturn(targetService.getBedUggIeCW(request));
    }

    /**
     * @author xnd
     * @since 2021-10-28
     * 床位异动EXCEL打印下载
     */
    @ApiOperation("床位异动--excel下载")
    @PostMapping("/getBedUggIeCWDownLoadExcel")
    public void getBedUggIeCWDownLoadExcel(@RequestBody BedUggieRequest requestInfo) throws IOException {
        targetService.getBedUggIeCWDownLoadExcel(requestInfo);
    }


    @GetMapping("/getThisIiInmaininfo")
    @ApiOperation("详情")
    public ResultObject getThisIiInmaininfo(@RequestParam String id) {
        return ResultObject.successReturn(targetService.getById(id));
    }



    @ApiOperation(value = "根据病人id获取病人详情(病人ID,是否可以转床isNotChange,病人名称)")
    @GetMapping("/getEemptyBedsDetails")
    public ResultObject getEemptyBedsDetails(@RequestParam String preId, @RequestParam String isNotChange, @RequestParam String name) {
        return ResultObject.successReturn(targetService.getPatient(preId, isNotChange));
    }

    @AutoYard
    @ApiOperation("获取住院列表信息")
    @PostMapping("/getHospitalized")
    public ResultObject getHospitalized(@RequestBody InpatientRegistrationCondition condition) {
        return ResultObject.successReturn(targetService.getHospitalized(condition));
    }

    @AutoYard
    @ApiOperation("获取出院列表信息")
    @PostMapping("/getLeaveHospital")
    public ResultObject getLeaveHospital(@RequestBody InpatientRegistrationCondition condition) {
        return ResultObject.successReturn(targetService.getLeaveHospital(condition));
    }
}

